millenniumwaraigisfandomcom-20200223-history
User blog:Lzlis/Interpreting POST responses
Before proceeding, you may want to reread http://www.nutaku.net/terms/ and consider how the following actions may relate to them. I will make references to my previous article including some of the programs provided there, so it is recommended to start there, especially if you are trying to do anything here yourself. Most game files come from HTTP GET requests. Basically, this means that it is just like downloading a file from the internet in your browser. The server doesn't care who you are, it just hands you the file. HTTP POST works differently -- in this case the game client sends some piece of information to the server and the server interprets this and decides how to respond. This means that you can't get data from HTTP POST just by putting the right URL into your browser's address bar. (Aside to those readers who actually know a lot about HTTP -- sorry for greatly oversimplifying and probably being wrong.) However, if you are inspecting your network traffic while playing Aigis, you can see the data that is passed back and forth. POST requests are made to a URL that looks like millenium-war.com / ID (without the spaces) where ID is some random-looking string of letters and numbers depending on what kind of request it is. Things that Aigis sends to the user in POST requests include data about the player units, metadata about missions/quests, all user specific information, results of sensitive random rolls done on the server, and more. Listed below are the most interesting documents (in my opinion). These are all downloaded after clicking on the start screen. * GRs733a4: general information about all the units in the game * QxZpjdfV: quest/mission metadata * oS5aZ5ll: user specific information about the units in your army In Firefox, to get the data, select the POST request in the network list, then click the "Response" tab. Note that you may also see an OPTIONS request for the same URL, but this can be ignored. Copy and paste this data into a text file. (Note that this is base64 encoded, but my program will automatically do the base64 decoding.) In Chrome, to get the data I recommend not using the response tab. (The data is binary, so I wouldn't trust copy and paste). Instead, right click on the request and choose "Copy response". Paste the result into a text file. It will look something like: "data:application/octet-stream;base64,RandomLettersNumbersForwardsSlashesPlusesEtc...". Delete the beginning part "data:application/octet-stream;base64," and save the file. (Note that this is also base64 encoded, but it is okay.) These documents are all (mostly?) XML (a human-readable format although it isn't always easy to read), but they are encoded. The following program will decode them: This requires "decode.lua" and "base64.lua" from my previous article. It also requires this new library: (If the response is not compressed, it may be necessary to comment out (or remove) the decompress line in parse_xml.lua. However, the three interesting documents I listed always seem to be compressed, so I'm not worrying about such things here.) The three interesting documents noted above represent big tables. The XML document has them organized by column which makes it awkward to read, even with an XML parser/viewer. So, below, I also provide a script that can be used instead of decode_xml.lua to output the table as an aligned text file (similar to the way my other scripts handle .atb files). This requires two additional library files given here: lib/xml.lua and lib/table.lua. (Yes, I have gone against conventional wisdom and written my own horrible XML parser. I know it sucks.)